package com.wjs.gulimall.gulimallware.dao;

import com.wjs.gulimall.gulimallware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 * 
 * @author wangjingsong
 * @email wangjingsong@gmail.com
 * @date 2022-04-17 15:40:15
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    void addStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);

    Long getSkuSumStock(@Param("id") Long sku);

    List<Long> listWareIdBySkuId(@Param("skuId") Long skuId);

    Long lockSkuStock(@Param("skuId") Long skuId, @Param("wareId")Long wareId, @Param("num")Integer num);

    void unLockStock(@Param("skuId") Long skuId, @Param("skuNum")Integer skuNum, @Param("wareId")Long wareId);
}
